﻿javascript:(function (){
	var userid =/sf_xw_user_id': '(.+)'/.exec(document.body.innerHTML)[1];	
//var preurl = http+'facebook.mafiawars.zynga.com/mwfb/remote/';
var preurl = MW_BASE_URL+'/';
function unix_timestamp() {
		return parseInt(new Date().getTime().toString().substring(0, 10))
	} 
var url = "prop1_extn.php?xw_controller=chromeExtension&xw_action=view";
request(url,handleSuccess,handleError);
function handleSuccess(msg) {
 console.info(msg);
 data = jQuery.parseJSON(msg);
 console.info(data);
 var tmp = data.data.markup.replace('position: absolute','position: relative');
 tmp = tmp.replace('-456px;','0;');
  $('#popup_fodder').append('<div id="can_reply">'+tmp.replace('margin-left: -64px; margin-top: 34px;','margin-left: 0; margin-top: 0;')+'</div>');
       $('#can_reply').dialog({position: [100,100], title: '★LOC@S★ נυαη ★L@★ - Quicktrigger' , close: function(){ $('#can_reply').remove(); }, width: 600});   
	   document.getElementsByClassName('text_marker_promo')[0].style.position="relative";
}
function handleError(){alert("Something went wrong");}
function request(url, handler, errorhandler) {
		if (url.indexOf('cb=') == -1) {
			url += '&cb='+userid+unix_timestamp();
		}
		if (url.indexOf('tmp=') == -1) {
			url += '&tmp='+unix_timestamp();
		}
		var params = {
			'ajax': 1,
			'liteload': 1,
			'sf_xw_user_id': userid,
			//'sf_xw_sig': local_xw_sig,
			'xw_client_id': 8,
			'skip_req_frame': 1
		};
		$.ajax({
			type: "POST",
			url: preurl+url,
			data: params,
			cache: false,
			success: handler,
			error: errorhandler
		});
	}	
})();

